package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {

        FileOutputStream fos = new FileOutputStream("pw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos,StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);// 自动行刷新 autoFlush:true
        Scanner sc = new Scanner(System.in);

        while (true) {
            String line = sc.nextLine();
            if ("exit".equalsIgnoreCase(line)) {
                break;
            }
            pw.println(line);
        }
        pw.close();


    }
}
